package br.indt.framework.ui.common;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import br.indt.framework.ui.ImageLoader;

public class PopUpLoadingItemFullTouch extends PopUpLoadingItem {
	private Image button = null;
	private boolean showCancelButton;

	public PopUpLoadingItemFullTouch() {
		super("popuploadingitem");
		button = ImageLoader.load("/single_action_bt.png");
	}	

	public void setShowCancelButton(boolean showCancelButton) {
		this.showCancelButton = showCancelButton;
	}

	public void paint(Graphics g, int x, int y, int maxWidth, int maxHeight) {
		
		g.setColor(0x747577);
		g.setClip(5, 86, 230, 228);
		g.fillRoundRect(5, 86, 230, 228, 4, 4);

		g.setColor(0xb9b9b9);
		g.fillRoundRect(7, 126, 226, 186, 0, 0);

		g.setFont(Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_MEDIUM));

		if (showCancelButton) {		
			g.drawImage(button, 16, 262, Graphics.TOP | Graphics.LEFT);
		}

		g.setColor(0xe6e6e6);
		g.drawString(getNote(), 15, 96, Graphics.TOP | Graphics.LEFT);
		
		if (showCancelButton) {
			g.drawString("Cancel", 120, 272, Graphics.TOP | Graphics.HCENTER);
		}

		lbNote.setTextColor(0xe6e6e6);
		lbNote.paint(g, 15, 96, maxWidth, maxHeight);

		int _type_icon = ICON_W*moving;

		// Add note icon
		g.setClip(ICON_X, ICON_Y, ICON_H, ICON_W);
		g.drawImage(icons, ICON_X-_type_icon, ICON_Y, Graphics.TOP | Graphics.LEFT);
	}


	public void pressFire() {
	}

	public void click(int x, int y) {
		if (!showCancelButton) {
			return;
		}
		
		if ((x >= 16 && x <= 224) && (y >= 262 && y <= 302)) {
			if (objectActionListener!= null){
				objectActionListener.objetcClicked(x,y,this);
			}
			
		}
	}
}